package com.fang.fen.blog.common.utils

import com.fang.fen.blog.common.exception.ApplicationException
import com.fang.fen.blog.common.vo.Response

object ResponseUtils {

    private val ERROR_CODE = "OK"

    private val MESSAGE = "OK"

    @JvmStatic
    fun convertException(e: ApplicationException): Response<Any> {
        return Response(e.errorCode, e.message)
    }

    @JvmStatic
    fun success(obj: Any): Response<Any> {
        return Response(ERROR_CODE, MESSAGE, obj)
    }

}
